"use strict";
exports.__esModule = true;
/**
 * @desc 判断两个对象是否相等
 * @param obj1
 * @param obj2
 * @return Boolean
 */
function equal(obj1, obj2) {
    var result = true;
    if (Array.isArray(obj1) !== Array.isArray(obj2))
        result = false;
    if (Array.isArray(obj1) && Array.isArray(obj2)) {
        if (obj1.length !== obj2.length)
            result = false;
        for (var i = 0; i < obj1.length; ++i) {
            if (typeof obj1[i] !== typeof obj2[i])
                result = false;
            if (typeof obj1[i] === "object" && typeof obj2[i] === "object") {
                result = equal(obj1[i], obj2[i]);
            }
            else {
                if (obj1[i] !== obj2[i])
                    result = false;
            }
        }
    }
    else {
        if (Object.getOwnPropertyNames(obj1).length !== Object.getOwnPropertyNames(obj2).length)
            result = false;
        if (Object.getOwnPropertySymbols(obj1).length !== Object.getOwnPropertySymbols(obj2).length)
            result = false;
        var judge_1 = function (ele) {
            if (!obj2[ele])
                result = false;
            if (typeof obj1[ele] !== typeof obj2[ele])
                result = false;
            if (typeof obj1[ele] === "object" && typeof obj2[ele] === "object") {
                result = equal(obj1[ele], obj2[ele]);
            }
            else {
                if (obj1[ele] !== obj2[ele])
                    result = false;
            }
        };
        Object.getOwnPropertyNames(obj1).forEach(function (ele) {
            judge_1(ele);
        });
        Object.getOwnPropertySymbols(obj1).forEach(function (ele) {
            judge_1(ele);
        });
    }
    return result;
}
exports["default"] = {
    equal: equal
};
